﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Org.Reddragonit.Dbpro.Connections.ClassSQL
{
    class QueryFunctions
    {

        private static readonly string[] _functions = new string[] {
			"ABS",
			"ACOS",
			"ADDDATE",
			"ADDTIME",
			"AES_DECRYPT",
			"AES_ENCRYPT",
			"ASCII",
			"ANALYSE",
			"AND",
			"ASIN",
			"ATAN2",
			"ATAN",
			"AVG",
			"BENCHMARK",
			"BETWEEN",
			"BIN",
			"BINARY",
			"BIT_AND",
			"BIT_COUNT",
			"BIT_LENGTH",
			"BIT_OR",
			"BIT_XOR",
			"CASE",
			"CAST",
			"CEIL",
			"CEILING",
			"CHAR_LENGTH",
			"CHAR",
			"CHARACTER_LENGTH",
			"CHARSET",
			"COALESCE",
			"COERCIBILITY",
			"COLLATION",
			"COMPRESS",
			"CONCAT_WS",
			"CONCAT",
			"CONNECTION_ID",
			"CONV",
			"CONVERT_TZ",
			"CONVERT",
			"COS",
			"COT",
			"COUNT",
			"COUNT",
			"CRC32",
			"CURDATE",
			"CURRENT_DATE",
			"CURRENT_TIME",
			"CURRENT_TIMESTAMP",
			"CURRENT_USER",
			"CURTIME",
			"DATABASE",
			"DATE_ADD",
			"DATE_FORMAT",
			"DATE_SUB",
			"DATE",
			"DATEDIFF",
			"DAY",
			"DAYNAME",
			"DAYOFMONTH",
			"DAYOFWEEK",
			"DAYOFYEAR",
			"DECODE",
			"DEFAULT",
			"DEGREES",
			"DES_DECRYPT",
			"DES_ENCRYPT",
			"DIV",
			"ELT",
			"ENCODE",
			"ENCRYPT",
			"EXP",
			"EXPORT_SET",
			"EXTRACT",
			"EXTRACTVALUE",
			"FIELD",
			"FIND_IN_SET",
			"FLOOR",
			"FORMAT",
			"FOUND_ROWS",
			"FROM_DAYS",
			"FROM_UNIXTIME",
			"GET_FORMAT",
			"GET_LOCK",
			"GREATEST",
			"GROUP_CONCAT",
			"HEX",
			"HOUR",
			"IF",
			"IFNULL",
			"IN",
			"INET_ATON",
			"INET_NTOA",
			"INSERT",
			"INSTR",
			"INTERVAL",
			"IS_FREE_LOCK",
			"IS_USED_LOCK",
			"IS",
			"ISNULL",
			"LAST_DAY",
			"LAST_INSERT_ID",
			"LCASE",
			"LEAST",
			"LEFT",
			"LENGTH",
			"LIKE",
			"LN",
			"LOAD_FILE",
			"LOCALTIME",
			"LOCALTIMESTAMP",
			"LOCATE",
			"LOG10",
			"LOG2",
			"LOG",
			"LOWER",
			"LPAD",
			"LTRIM",
			"MAKE_SET",
			"MAKEDATE",
			"MAKETIME",
			"MASTER_POS_WAIT",
			"MATCH",
			"MAX",
			"MD5",
			"MICROSECOND",
			"MID",
			"MIN",
			"MINUTE",
			"MOD",
			"MONTH",
			"MONTHNAME",
			"NAME_CONST",
			"NOT",
			"NOW",
			"NULLIF",
			"OCT",
			"OCTET_LENGTH",
			"OLD_PASSWORD",
			"ORD",
			"PASSWORD",
			"PERIOD_ADD",
			"PERIOD_DIFF",
			"PI",
			"POSITION",
			"POW",
			"POWER",
			"QUARTER",
			"QUOTE",
			"RADIANS",
			"RAND",
			"REGEXP",
			"RELEASE_LOCK",
			"REPEAT",
			"REPLACE",
			"REVERSE",
			"RIGHT",
			"RLIKE",
			"ROUND",
			"ROW_COUNT",
			"RPAD",
			"RTRIM",
			"SCHEMA",
			"SEC_TO_TIME",
			"SECOND",
			"SESSION_USER",
			"SHA1",
			"SHA",
			"SIGN",
			"SIN",
			"SLEEP",
			"SOUNDEX",
			"SOUNDS",
			"SPACE",
			"SQRT",
			"STD",
			"STDDEV_POP",
			"STDDEV_SAMP",
			"STDDEV",
			"STR_TO_DATE",
			"STRCMP",
			"SUBDATE",
			"SUBSTR",
			"SUBSTRING_INDEX",
			"SUBSTRING",
			"SUBTIME",
			"SUM",
			"SYSDATE",
			"SYSTEM_USER",
			"TAN",
			"TIME_FORMAT",
			"TIME_TO_SEC",
			"TIME",
			"TIMEDIFF",
			"TIMESTAMP",
			"TIMESTAMPADD",
			"TIMESTAMPDIFF",
			"TO_DAYS",
			"TRIM",
			"TRUNCATE",
			"UCASE",
			"UNCOMPRESS",
			"UNCOMPRESSED_LENGTH",
			"UNHEX",
			"UNIX_TIMESTAMP",
			"UPDATEXML",
			"UPPER",
			"USER",
			"UTC_DATE",
			"UTC_TIME",
			"UTC_TIMESTAMP",
			"UUID_SHORT",
			"UUID",
			"VALUES",
			"VAR_POP",
			"VAR_SAMP",
			"VARIANCE",
			"VERSION",
			"WEEK",
			"WEEKDAY",
			"WEEKOFYEAR",
			"XOR",
			"YEAR",
			"YEARWEEK"
        };

        public static bool IsFunction(string name)
        {
            bool ret = false;
            foreach (string str in _functions)
            {
                if (name == str)
                {
                    ret = true;
                    break;
                }
            }
            return ret;
        }

    }
}
